fix(console): 打包 console 时注入本仓库 client,杜绝新 UI + 旧 client 漂移#2513
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The console SPA inlines @objectstack/client, and the version came from objectui's own lockfile — which necessarily lags the framework whenever a release adds new client APIs (the new client isn't on npm when objectui's lockfile is written). 11.5.0 shipped the new import UI bundled against client 11.2.0, so the console threw "The connected @objectstack/client does not support async import jobs." at runtime. build-console.sh now exports OBJECTSTACK_CLIENT_DIST=packages/client so vite aliases the bundled client to this repo's own build — the bundled client always matches the framework release, eliminating the framework → objectui pin-bump → framework re-release round-trip. Details: - Fail hard if the pinned objectui SHA lacks the vite.config.ts hook. - Build the client dist first if missing. - Split the build: deps via turbo, the console app via its own build script directly — turbo v2 strict env strips undeclared vars, which is exactly how the first injection attempt silently produced a stale bundle. - Post-build canary (CONSOLE_BUNDLE_CANARY, default 'import/jobs') asserts the fresh client actually landed in dist/assets. Verified: rebuilt at the currently pinned SHA 1432efe81 (whose lockfile still resolves client 11.2.0) — dist now contains the import/jobs routes; before this change it had zero occurrences. Fixes #2512
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2512
问题
@objectstack/console@11.5.0运行时报 "The connected @objectstack/client does not support async import jobs."。根因:
build-console.sh按 objectui 自己的 lockfile 安装依赖后打包,console bundle 里的 client 版本由 objectui lockfile 决定。发版时新 client 还没上 npm,objectui lockfile 不可能指向它 → 发布产物 = 新导入 UI + client 11.2.0(无data.createImportJob)。已在 os-tianshun-ehr 逐环验证(实际 serve 的 dist 中import/jobs出现 0 次)。按旧机制,今后凡是给 client 加新 API 且 UI 依赖,都要「发 framework → objectui bump pin → framework 再发一版」两段式。本 PR 终结这个问题。
改动(仅
scripts/build-console.sh)export OBJECTSTACK_CLIENT_DIST=<framework>/packages/client,vite 把本仓库、本版本的 client 打进 bundle(objectui 的apps/console/vite.config.ts钩子,main 已有;pinned SHA 缺钩子时报错退出,不静默漂移)。client dist 缺失时先构建。dist/assets必须含import/jobs(CONSOLE_BUNDLE_CANARY可换),否则脚本失败——旧 client 再也不可能静默发布出去。验证
在当前 pinned SHA
1432efe81(lockfile 仍解析 client 11.2.0)上完整跑scripts/build-console.sh:import/jobs0 次(即线上 11.5.0 的状态)import/jobs进入dist/assets,canary 断言通过,脚本 exit 0即:不等 objectui 换 SHA,以现 pin 重打 dist 即可发
@objectstack/console@11.5.1修复线上。另外 objectui 侧真实链路 E2E(真 console + npm client@11.5.0 + 真后端,后台导入→历史→撤销)已通过,见 objectstack-ai/objectui#2146。